from django.db import models


class registryInfo(models.Model):
    '''
    仓库地址
    '''
    env = models.CharField(max_length=20, null=False, blank=False, verbose_name="环境", help_text="环境")
    registry = models.CharField(max_length=200, null=False, blank=False, verbose_name="仓库地址", help_text="仓库地址")
    namespace = models.CharField(max_length=20, unique=True, null=True, blank=True, verbose_name="命名空间",
                                 help_text="命名空间")
    username = models.CharField(max_length=100, null=True, blank=True, verbose_name="仓库帐号", help_text="仓库帐号")
    password = models.CharField(max_length=200, null=True, blank=True, verbose_name="仓库密码", help_text="仓库密码")
    label = models.CharField(max_length=100, null=True, blank=True, verbose_name="备注", help_text="备注")
    create_time = models.DateTimeField(auto_now_add=True, null=True, blank=True, verbose_name="创建日期", help_text="创建日期")
    update_time = models.DateTimeField(auto_now=True, null=True, blank=True, verbose_name="更新日期", help_text="更新日期")

    class Meta:
        verbose_name = "仓库地址"
        verbose_name_plural = verbose_name
        ordering = ['id']
        db_table = "registry_info"

    def __str__(self):
        return self.env


class robot_dtalk(models.Model):
    '''
    钉钉机器人群消息
    '''
    robot_name = models.CharField(max_length=50, null=True, blank=True, verbose_name="机器人名称", help_text="机器人名称")
    create_time = models.DateTimeField(auto_now_add=True, verbose_name="创建日期", help_text="创建日期")
    update_time = models.DateTimeField(auto_now=True, verbose_name="更新日期", help_text="更新日期")
    webhook = models.URLField(verbose_name="webhook", help_text="webhook")

    class Meta:
        verbose_name = "钉钉机器人"
        verbose_name_plural = verbose_name
        db_table = "deploy_dtalk"
